package com.hwy.catering.controller;

import com.hwy.catering.dto.CategoryDto;
import com.hwy.catering.entity.Category;
import com.hwy.catering.service.CategoryService;
import com.hwy.catering.service.DishService;
import com.hwy.catering.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Api(tags = "餐品类别接口")
@RestController
@RequestMapping("/cater/category")
public class CategoryController {

    @Resource
    private CategoryService categoryService;

    @ApiOperation("查找所有菜品类别")
    @PostMapping("/findDetailCategory/{type}")
    public R findDetailCategory(@PathVariable("type") Integer type){
        R r = categoryService.findDetailCategory(type);
        return r;
    }

    @ApiOperation(value = "查询所有类别")
    @PostMapping("/findCategory")
    public R findCategory(){
        R r = categoryService.findCategory();
        return r;
    }

    @ApiOperation(value = "添加类别")
    @PostMapping("/addCategory")
    public R addCategory(@RequestBody Category category){
        R r = categoryService.addCategory(category);
        return r;
    }

    @ApiOperation(value = "删除类别")
    @PostMapping("/deleteCategory")
    public R deleteCategory(@RequestBody CategoryDto categoryDto){
        R r = categoryService.deleteCategory(categoryDto);
        return r;
    }
}
